-- stage_recover2
-- created by panyl
-- 进入下层恢复属性N

return {
    apply = function(prop, baseValue)
        return prop[3];
    end,

    -- 进入下层触发触发
    trigger = function(who, prop, arg)
        local attrib = prop[2];
        local count  = prop[3];

        -- 特定冈布奥效果翻倍，只对玩家起效
        local p = PropM.combine(who, "slime_double", prop[2]);
        if p[3] > 0 and who.type == OBJECT_TYPE_USER then
            local classId = ME.user.dbase:query("active_pet", 0);
            if classId == p[3] then
                count = PropM.apply(p, count)
            end
        end

        BonusM.doBonus({ 2, attrib, count, }, "prop stage_recover2");

        return prop[3];
    end,

    desc = function(prop)
        local row = PropM.getRow(prop[1]);
        local desc = row.desc;
        local attrib = FieldsM.getFieldName(prop[2]);
        if attrib then
            desc = string.gsub(desc, "{0}", attrib);
        end

        -- 根据属性，显示“恢复”或“获得”
        if prop[2] == "money" or prop[2] == "search_point" then
            desc = string.gsub(desc, "{recover}", getLocStr("gain"));
        else
            desc = string.gsub(desc, "{recover}", getLocStr("recover"));
        end

        desc = string.gsub(desc, "{1}", prop[3]);

        return desc;
    end,

    record = function(target, prop, path)
        return false;
    end
};